我正在尝试教程Using Cloud Datastore with Python,但是当我跑步时:
virtualenv -p python3 env
我收到了一个错误:
The path python3 (from --python=python3) does not exist
我通过运行:
检查了python版本python -V
它给了我:
Python 3.5.2 :: Anaconda 4.1.1 (64-bit)
我运行set python
来查看环境变量,它给了我:
Environment variable python not defined
令人烦恼的是,这是一台我没有管理员权限的实验室机器,我需要通过电子邮件向IT管理员发送更改环境变量。
尝试:virtualenv -p python env
它给了我:
The path python (from --python=python) does not exist
似乎在环境变量修复之前没有办法解决。
答案 0 :(得分:8)
阅读此tutorial后,我找到了我的案例的解决方法:
virtualenv --python "C:\\Anaconda3\\python.exe" env
答案 1 :(得分:4)
如果python --V
显示的版本大于3,那么为什么不尝试:
virtualenv -p python env
代替? p
标志的值只是指您想要创建虚拟环境的python版本。在这种情况下,python
大于版本3.
答案 2 :(得分:2)
使用以下内容: virtualenv --python“您的python.exe路径”'虚拟文件夹的名称'。您可以从环境变量中获取python.exe路径,该路径属于“此PC ”或“我的电脑”的属性。
然后进入该文件夹并运行命令: 。\ Scripts \ activate
答案 3 :(得分:0)
只需评论:在Win10上,对于python3脚本,我运行py c:\ path \ to \ script。
例如:
class TaskCreator():
task_count = 0
@classmethod
def add_task(cls):
if menu == "a" or menu == "A":
with open( 'user.txt' ) as fin :
usernames = [i.split(',')[0] for i in fin.readlines() if len(i) > 3]
task = input ("Please enter the username of the person the task is assigned to.\n")
while task not in usernames :
task = input("Username not registered. Please enter a valid username.\n")
else:
task_title = input("Please enter the title of the task.\n")
task_description = input("Please enter the task description.\n")
task_due = input("Please input the due date of the task. (yyyy-mm-dd)\n")
date = datetime.date.today()
task_completed = False
if task_completed == False:
task_completed = "No"
else:
task_completed = ("Yes")
with open('tasks.txt', 'a') as task1:
cls.task_count += 1
task1.write("\nUser assigned to task" + str(cls.task_count) + "\n" + task + "\nTask Title :" + "\n" + task_title + "\n" + "Task Description:\n" + task_description + "\n" + "Task Due Date:\n" + task_due + "\n" + "Date Assigned:\n" + str(date) + "\n" + "Task Completed:\n" + task_completed + "\n")
print("The new assigned task has been saved")
TaskCreator.add_task()
因此,为了使上述命令起作用,我使用了:
py -m pip --version
和:
py -m venv env
所以这也是可能的解决方案。