V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
wyc9296
V2EX  ›  Python

(windows)在一台新的电脑没安装 Python ,只是从旧电脑 copy 了虚拟环境的文件夹进去,可以单独运行脚本吗?

  •  1
     
  •   wyc9296 · 2019-04-03 10:57:41 +08:00 · 1781 次点击
    这是一个创建于 1843 天前的主题,其中的信息可能已经有所发展或是发生改变。

    把虚拟环境的 scripts 目录下所有 text 格式的文件中路径都更改了;如果安装 python 的话,虚拟环境运行里面的脚本 ok,但是把 python 卸载掉,就会报错:

    Failed to import the site module
    Traceback (most recent call last):
      File "C:\Users\E\Desktop\moduleTest\venv\lib\site.py", line 791, in <module>
        main()
      File "C:\Users\E\Desktop\moduleTest\venv\lib\site.py", line 768, in main
        paths_in_sys = addsitepackages(paths_in_sys)
      File "C:\Users\E\Desktop\moduleTest\venv\lib\site.py", line 280, in addsitepackages
        addsitedir(sitedir, known_paths)
      File "C:\Users\E\Desktop\moduleTest\venv\lib\site.py", line 211, in addsitedir
        addpackage(sitedir, name, known_paths)
      File "C:\Users\E\Desktop\moduleTest\venv\lib\site.py", line 179, in addpackage
        exec(line)
      File "<string>", line 1, in <module>
      File "C:\Users\E\Desktop\moduleTest\venv\lib\importlib\util.py", line 13, in <module>
        from contextlib import contextmanager
    ImportError: No module named 'contextlib'
    
    
    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3562 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 849ms · UTC 05:00 · PVG 13:00 · LAX 22:00 · JFK 01:00
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.